<?php
session_start();
include_once('config/db_conn.php');
include_once('db_config/db_user.php');
include_once('db_config/db_gigs.php');
include_once('db_config/db_sentmail.php');
include_once('db_config/db_inbox.php');
include_once('db_config/db_websetting.php');

$websetting= new websetting();
$rs_websetting=$websetting->uniq_websettings('websetting_id',$websetting_id);
$data_websetting=mysql_fetch_array($rs_websetting);
$sentmail=new sentmail();
$inboxmail=new inbox();

$mailid = @base64_decode($_REQUEST['id']);
if($mailid<=0)
reDirect('messages.php');

$mailinfo = mysql_fetch_assoc($sentmail->uniq_sentmail_list('id',$mailid));
$inboxmail->updateInfo(array('read_status'=>'Y'),$mailid);

$user=new user();
$rs_user_from=$user->uniq_user_list('user_id',$mailinfo['from_id']);
$data_user_from=mysql_fetch_array($rs_user_from);

$rs_user_to=$user->uniq_user_list('user_id',$mailinfo['to_id']);
$data_user_to=mysql_fetch_array($rs_user_to);
$gigs_obj=new gigs();
$rs_gigs=$gigs_obj->uniq_gigs_list('id',$mailinfo['gigs_id']);
$data_gigs=mysql_fetch_array($rs_gigs);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $data_websetting['change_title']; ?></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<script type="text/javascript" src="javascript/jquery.simplemodal.js"></script>
<script type="text/javascript" src="javascript/init.js"></script>
<script type="text/javascript" src="javascript/init1.js"></script>
</head>
<body >
<div id="container" class="content">

<!--HEADER AREA-->
<?php include('header.php')?>
<!--HEADER AREA END-->
<div id="main" class="clearfix">
	<div class="main-tl">
	  	<div class="main-tr"></div>
	  	<div class="main-top"></div>
	</div>
	<div class="main-inner clearfix">
		<div class="side1">
		<!-- side1 content BEGIN =============================================================================================== -->
<div class="messages view message-view-block">
	<div class="main-content-block js-corner round-5">
		<div class="mail-side-two">
			<form enctype="multipart/form-data"  action="" method="post" id="MessageMoveToForm" class="normal">
				<div class="mail-main-curve">
					<div class="inbox-block clearfix">
						<div class="inbox-block1 message-view-inbox clearfix">
							<p><a href="messages.php?mailbox=inbox">Inbox</a></p>
							<p><a href="messages.php?mailbox=sent">Sent items</a></p>			
                		</div>
					</div>
					<div class="message-block clearfix">
						<div class="message-block-left"></div>
						<div class="message-block-right">
							<!--
    						<div class="submit">
								<input type="submit" value="Delete" name="data[Message][Delete]" />
							</div>
							-->		
							<?php if($_REQUEST['type']=="inbox"){ ?>							
							<div class="cancel-block">
								<a href="new_messages.php?gig_id=<?=$mailinfo['gigs_id'];?>&to=<?=$data_user_from['user_name'];?>">Reply</a>				
							</div>
							<?php 
							}?>	
						</div>
        			</div>
              		<div class="mail-body js-corner mail-content-curve-middle">
                    	<div class="clearfix">
                    		<div class="mail-sender-name">
                				<p class="clearfix">
				                    <span class="sender-name">
										<span class="message-title">From: </span>
										<a title="kimara2009" href="#">
											<span class="c"><?php echo $data_user_from['user_name']; ?></span>
										</a>													
									</span>
								</p>
							</div>
                			<div class="mail-date-time">
                    			<p class="1167 clearfix">
									<span class="js-show-mail-detail-span message-title">Date:</span>
									<span class="c"><?php echo $mailinfo['date_time']; ?></span>
								</p>
			                </div>
			            </div>
						<div class="mail-content-curve-middle clearfix">
	               			<p class="clearfix">
							   	<span class="show-details-left message-title">Gig:</span>
								<a title="<?php echo $data_gigs['gigs_title']; ?>" href="users_<?php echo $to;?>_gigs_<?php  echo str_replace(' ','-', $data_gigs['gigs_title']);?>"><span class="c"><?php echo $data_gigs['gigs_title']; ?></span></a>												</p>
	              			<p class="clearfix"><span class="show-details-left message-title">Order: </span> </p>
							<p class="subject-info clearfix"><span class="show-details-left message-title">Subject: </span>
								<span class="c"><?php echo $mailinfo['sub']; ?></span>				
							</p>
							<div class="message-description">
								<br />
								<?php echo $mailinfo['body'];?>				
							</div>
							<p class="replay-forward-links clearfix"></p>
			                <div class="download-block"></div>
			            </div>
			       	</div>	          
			    </div>
			</form>
		</div>
	</div>
</div>
		<!-- side1 content END ============================================================================================ -->
		</div><!-- end side1 -->
		<!-- side2 BEGIN ====================== -->
		<?php include('right.php'); ?>
		<!-- side2 END ====================== -->
	</div><!-- end main-inner-->
</div><!-- end main -->

<!--FOOTER AREA-->
<?php include('footer.php');?>
 <!--FOOTER AREA END-->

</div><!-- end container -->
</body>
</html>